﻿using Ex1.School;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;

namespace Ex2.TestSchool
{
    [TestClass()]
    public class StudentTest
    {
        [TestMethod()]
        public void StudentConstructorTest()
        {
            string name = "Kristian";
            int facultyNumber = 61272;
            Student target = new Student(name, facultyNumber);

            Assert.IsNotNull(target);
            Assert.AreEqual(name, target.Name);
            Assert.AreEqual(facultyNumber, target.FacultyNumber);
        }

        [TestMethod()]
        [ExpectedException(typeof(ArgumentException), "Faculty number is not valid 5 digit number!")]
        public void FacultyNumberTest()
        {
            Student target = new Student("Pesho",123);
            Assert.IsNotNull(target);
        }

        [TestMethod()]
        [ExpectedException(typeof(ArgumentException), "Faculty number is not unique in the system!")]
        public void UniqueFacultyNumberTest()
        {
            string name = "Kristian";
            int facultyNumber = 61272;
            Student studentOne = new Student(name, facultyNumber);
            Student studentTwo = new Student(name, facultyNumber);
        }

        [TestMethod()]
        [ExpectedException(typeof(ArgumentException), "Name cannot be empty!")]
        public void EmptyNameTest()
        {
            string name = "";
            int facultyNumber = 61023;
            Student target = new Student(name, facultyNumber);
        }

        [TestMethod()]
        [ExpectedException(typeof(ArgumentNullException), "Name cannot be null!")]
        public void NullNameTest()
        {
            string name = null;
            int facultyNumber = 61023;
            Student target = new Student(name, facultyNumber);
        }
    }
}
